package chapter2.No2_2_synchronized同步语句块.g将任意对象作为对象监视器.demo3;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016/11/12.
 */
public class ServiceClass {

    List list = new ArrayList();

    public synchronized void addObject(String data) {
        list.add(data);
    }

    public synchronized int getSize() {
        return list.size();
    }
}
